﻿using Microsoft.EntityFrameworkCore;
using Product.EntityFrameworkCore;
using Product.EntityFrameworkCore.PO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Product.Application.Query
{
    public class SkuQueryService: ISkuQueryService
    {
        private readonly ProductContext _productContext;
        public SkuQueryService(ProductContext productContext) 
        {
            _productContext = productContext;
        }
        public async Task<List<SkuPo>> GetVerifySkuList(List<string> skuIdList) 
        {
           var skuList= await _productContext
                .Sku
                .Where(e=>skuIdList.Contains(e.Id))
                .Select(e=>new SkuPo 
                {
                  Id=e.Id,
                  SalesStatus=e.SalesStatus,
                  Stock=e.Stock               
                }).ToListAsync();

            return skuList;
        }
    }
}
